﻿using System;
using System.Collections.Generic;
using System.Text;
using WindowsLive.Writer.Api;
using System.Windows.Forms;

namespace LiveWriterBTFL
{
    [WriterPlugin("18d43e01-4549-4fde-8ca6-c7b4b7385fac","The (B|T|L) Maker",PublisherUrl = "http://theblobfarm.wordpress.com",Description ="Build (B|T|L|F) markup",HasEditableOptions = true)]
    [InsertableContentSource("Placeholder")]
    public class MainPlumbingBTFL : SmartContentSource
    {
    

        public override DialogResult CreateContent(IWin32Window dialogOwner,ISmartContent newContent)
        {
            PluginSettings settings = new PluginSettings(newContent.Properties);
            using (frmMain main = new frmMain(settings))
            {
                DialogResult result = main.ShowDialog();
                if (result == DialogResult.OK)
                    newContent = main.SelectedContent;
                return result;
            }
        }
        public override SmartContentEditor CreateEditor(ISmartContentEditorSite editorSite)
        {
            return new BTFLEditor();
        }
        public override string GeneratePublishHtml(ISmartContent content,IPublishingContext publishingContext)
        {
            PluginSettings settings = new PluginSettings(content.Properties);
            return settings.FinalText;
        }
        public override string GenerateEditorHtml(ISmartContent content,IPublishingContext publishingContext)
        {
            PluginSettings settings = new PluginSettings(content.Properties);
            return settings.PlaceHolder;
        }
    }
}
